class_name WeaponBehavior
extends Node2D



var _weapon: WeaponBase
# 暴击
var _critical: bool = false



func _ready():
	_weapon = owner as WeaponBase


## 攻击，在子类中重写
func execute_attack():
	pass


## 获取计算出来的武器伤害
func get_damage() -> int:
	var damage := _weapon.data.weapon_stats.damage + _weapon.player.stats.damage
	var critical_chance := _weapon.data.weapon_stats.critical_chance
	if Sundry.success_chance(critical_chance, 1.0):
		_critical = true
		damage = ceil(float(damage) * _weapon.data.weapon_stats.critical_multiplier)
	return damage
